﻿
public class ClientManager:Dict<string,BaseClient>
{
    public void Add(BaseClient client)
    {
        Add(client.Id, client);
    }
    public override void Remove(string key)
    {
        if (IsExist(key))
        {
            BaseClient client = GetValue(key);
            if(client != null)
            {
                if(client.TcpClient != null && client.TcpClient.Connected)
                {
                    client.TcpClient.Close();
                    client.TcpClient.Dispose();
                }                      
            }
            Dictionary.Remove(key);
        }
    }
    public void Remove(BaseClient client)
    {
        Remove(client.Id);
    }
}
